<template>
	<view class="pick_item" @click="goSelectPick">
		<view class="pick_l">
			<template v-if="vuex_pick">
				<view class="adress u-line-2">{{vuex_pick?vuex_pick.address:''}}</view>
				<view class="name">
					<view class="name_txt u-line-1">{{vuex_pick.name}}</view>
					<view class="dist" v-if="vuex_pick.distance > 0">
						距离:{{(vuex_pick.distance/1000).toFixed(2)}}km
					</view>
				</view>
			</template>
			<template v-else>点击设置默认自提地址</template>
		</view>
		<div class="line"></div>
		<view class="pick_btn">
			<view class="tip">切换更多自提点</view>
			<view class="iconfont iconfont-e775"></view>
		</view>
	</view>
</template>

<script>
	import {
		configMixin
	} from './configMixin.js';
	import {
		mapState
	} from 'vuex';
	export default {
		mixins: [configMixin],
		computed: {
			...mapState(['vuex_pick'])
		},
		watch: {
			templateItem: {
				handler(item) {
					if (item.code) {
						this.initList(item);
					}
				},
				immediate: true
			}
		},
		methods: {
			init() {},
			initList() {

			},
			goSelectPick() {
				this.$linkTo(`/package/product/local/pickUpAddress/index?overAll=1`)
			}
		}
	};
</script>

<style scoped lang="scss">
	.pick_item {
		display: flex;
		align-items: center;
		margin: 20rpx;
		background-color: #fff;
		padding: 30rpx 20rpx;
		border-radius: 8rpx;

		.pick_l {
			flex: 1;
			overflow: hidden;

			.adress {
				font-weight: bold;
			}

			.name {
				color: #666;
				font-size: 24rpx;
				display: flex;
				align-items: center;

				.name_txt {
					flex: 1;
					overflow: hidden;
				}
				.dist{
					margin-left: 6rpx;
				}
			}
		}

		.line {
			height: 74rpx;
			border-right: 1rpx solid #D8D8D8;
			margin: 0 20rpx 0 28rpx;
		}

		.pick_btn {
			font-size: 24rpx;
			color: #858585;
			display: flex;
			align-items: center;

			.tip {
				width: 100rpx;
			}

			.iconfont {
				color: #DDDDDD;
				margin-left: 10rpx;
			}
		}
	}
</style>
